﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ERP.Business.DataTypes.Employee.Vacations
{
    [System.Runtime.Serialization.DataContract]
    [Serializable]
    public class Vacation : BaseTypes.BaseType
    {
        private DateTime m_StartDate;
        private DateTime m_EndDate;
        private DateTime m_ActualReturningDate;
        private VacationType m_Type = VacationType.None;
        private VacatioStatus m_Status = VacatioStatus.None;
        private string m_Notes = null;
        private DateTime m_OfferedDate;
        private float m_DaysCount;
        private float m_PayedPeriod;
        private float m_UnPayedPeriod;
        private bool m_DeductionFlag = false;

        [System.Runtime.Serialization.DataMember]
        public DateTime StartDate
        {
            get { return m_StartDate; }
            set { m_StartDate = value; }
        }
        [System.Runtime.Serialization.DataMember]
        public DateTime EndDate
        {
            get { return m_EndDate; }
            set { m_EndDate = value; }
        }
        [System.Runtime.Serialization.DataMember]
        public DateTime ActualReturningDate
        {
            get { return m_ActualReturningDate; }
            set { m_ActualReturningDate = value; }
        }
        [System.Runtime.Serialization.DataMember]
        public VacationType Type
        {
            get { return m_Type; }
            set { m_Type = value; }
        }
        [System.Runtime.Serialization.DataMember]
        public VacatioStatus Status
        {
            get { return m_Status; }
            set { m_Status = value; }
        }
        [System.Runtime.Serialization.DataMember]
        public string Notes
        {
            get { return m_Notes; }
            set { m_Notes = value; }
        }
        [System.Runtime.Serialization.DataMember]
        public DateTime OfferedDate
        {
            get { return m_OfferedDate; }
            set { m_OfferedDate = value; }
        }
        [System.Runtime.Serialization.DataMember]
        public float DaysCount
        {
            get { return m_DaysCount; }
            set { m_DaysCount = value; }
        }
        [System.Runtime.Serialization.DataMember]
        public float PayedPeriod
        {
            get { return m_PayedPeriod; }
            set { m_PayedPeriod = value; }
        }
        [System.Runtime.Serialization.DataMember]
        public float UnPayedPeriod
        {
            get { return m_UnPayedPeriod; }
            set { m_UnPayedPeriod = value; }
        }
        [System.Runtime.Serialization.DataMember]
        public bool DeductionFlag
        {
            get { return m_DeductionFlag; }
            set { m_DeductionFlag = value; }
        }

        public override int Compare(object x, object y)
        {
            if (ERP.Framework.Components.ComparingHelper.ComapringManager.CompareTypes(x, y))
                return ((Vacation)x).EndDate.CompareTo(((Vacation)y).EndDate);
            return -1;
        }

        public override object Clone()
        {
            Vacation v = new Vacation();
            v.ActualReturningDate = ActualReturningDate;
            v.DaysCount = DaysCount;
            v.DeductionFlag = DeductionFlag;
            v.EndDate = EndDate;
            v.ID = ID;
            v.Notes = Notes;
            v.OfferedDate = OfferedDate;
            v.PayedPeriod = PayedPeriod;
            v.StartDate = StartDate;
            v.Status = Status;
            v.Type = Type;
            v.UnPayedPeriod = UnPayedPeriod;
            return v;
        }
    }
}
